<!DOCTYPE html>












  


<html class="theme-next gemini use-motion" lang="Chinese">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2"/>
<meta name="theme-color" content="#222">












<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />






















<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=6.4.0" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=6.4.0">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=6.4.0">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=6.4.0">


  <link rel="mask-icon" href="/images/logo.svg?v=6.4.0" color="#222">









<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '6.4.0',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="简介在.Net中，Applicaion Data相当于一个结构化存储器，在存储一些配置信息的时候，使用非常方便。在应用更新以后，配置不会丢失，在应用写在以后会自动删除，并且也使用了加密存储，没有安全问题。 这里是关于App Settings的一些特性  用来保存配置数据，最深32层，不限数量，可以保存在本地且可以漫游。 　　AppSettings支持除二进制外的所有WinRT数据格式，如果存储二进">
<meta name="keywords" content="C#,UWP,存储">
<meta property="og:type" content="article">
<meta property="og:title" content="使用C#封装一个UWP Applicaion Data的结构化存储类">
<meta property="og:url" content="http://blog.zhengzi.me/2016/09/25/e4-bd-bf-e7-94-a8c-e5-b0-81-e8-a3-85-e4-b8-80-e4-b8-aauwp-applicaion-data-e7-9a-84-e7-bb-93-e6-9e-84-e5-8c-96-e5-ad-98-e5-82-a8-e7-b1-bb/index.html">
<meta property="og:site_name" content="政子的博客">
<meta property="og:description" content="简介在.Net中，Applicaion Data相当于一个结构化存储器，在存储一些配置信息的时候，使用非常方便。在应用更新以后，配置不会丢失，在应用写在以后会自动删除，并且也使用了加密存储，没有安全问题。 这里是关于App Settings的一些特性  用来保存配置数据，最深32层，不限数量，可以保存在本地且可以漫游。 　　AppSettings支持除二进制外的所有WinRT数据格式，如果存储二进">
<meta property="og:locale" content="Chinese">
<meta property="og:updated_time" content="2018-08-21T09:49:42.773Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="使用C#封装一个UWP Applicaion Data的结构化存储类">
<meta name="twitter:description" content="简介在.Net中，Applicaion Data相当于一个结构化存储器，在存储一些配置信息的时候，使用非常方便。在应用更新以后，配置不会丢失，在应用写在以后会自动删除，并且也使用了加密存储，没有安全问题。 这里是关于App Settings的一些特性  用来保存配置数据，最深32层，不限数量，可以保存在本地且可以漫游。 　　AppSettings支持除二进制外的所有WinRT数据格式，如果存储二进">






  <link rel="canonical" href="http://blog.zhengzi.me/2016/09/25/e4-bd-bf-e7-94-a8c-e5-b0-81-e8-a3-85-e4-b8-80-e4-b8-aauwp-applicaion-data-e7-9a-84-e7-bb-93-e6-9e-84-e5-8c-96-e5-ad-98-e5-82-a8-e7-b1-bb/"/>



<script type="text/javascript" id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>使用C#封装一个UWP Applicaion Data的结构化存储类 | 政子的博客</title>
  









  <noscript>
  <style type="text/css">
    .use-motion .motion-element,
    .use-motion .brand,
    .use-motion .menu-item,
    .sidebar-inner,
    .use-motion .post-block,
    .use-motion .pagination,
    .use-motion .comments,
    .use-motion .post-header,
    .use-motion .post-body,
    .use-motion .collection-title { opacity: initial; }

    .use-motion .logo,
    .use-motion .site-title,
    .use-motion .site-subtitle {
      opacity: initial;
      top: initial;
    }

    .use-motion {
      .logo-line-before i { left: initial; }
      .logo-line-after i { right: initial; }
    }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="Chinese">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">政子的博客</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
      
        <p class="site-subtitle">强迫症|学习者|伪文青</p>
      
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="Toggle navigation bar">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">
    <a href="/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-home"></i> <br />Home</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-about">
    <a href="/about/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-user"></i> <br />About</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">
    <a href="/tags/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />Tags</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">
    <a href="/archives/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />Archives</a>
  </li>

      
      
    </ul>
  

  

  
</nav>



  



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
            

          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://blog.zhengzi.me/2016/09/25/e4-bd-bf-e7-94-a8c-e5-b0-81-e8-a3-85-e4-b8-80-e4-b8-aauwp-applicaion-data-e7-9a-84-e7-bb-93-e6-9e-84-e5-8c-96-e5-ad-98-e5-82-a8-e7-b1-bb/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Jason Bian">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="政子的博客">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">使用C#封装一个UWP Applicaion Data的结构化存储类
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">Posted on</span>
              

              
                
              

              <time title="Created: 2016-09-25 16:58:35" itemprop="dateCreated datePublished" datetime="2016-09-25T16:58:35+08:00">2016-09-25</time>
            

            
              

              
                
                <span class="post-meta-divider">|</span>
                

                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                
                  <span class="post-meta-item-text">Edited on</span>
                
                <time title="Modified: 2018-08-21 17:49:42" itemprop="dateModified" datetime="2018-08-21T17:49:42+08:00">2018-08-21</time>
              
            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">In</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/C/" itemprop="url" rel="index"><span itemprop="name">C#</span></a></span>

                
                
                  , 
                
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/C/UWP/" itemprop="url" rel="index"><span itemprop="name">UWP</span></a></span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="简介"><a href="#简介" class="headerlink" title="简介"></a>简介</h2><p>在.Net中，Applicaion Data相当于一个结构化存储器，在存储一些配置信息的时候，使用非常方便。在应用更新以后，配置不会丢失，在应用写在以后会自动删除，并且也使用了加密存储，没有安全问题。 这里是关于App Settings的一些特性</p>
<ul>
<li>用来保存配置数据，最深32层，不限数量，可以保存在本地且可以漫游。</li>
<li>　　AppSettings支持除二进制外的所有WinRT数据格式，如果存储二进制数据得用文件。</li>
<li>　　系统只验证数据格式和长度，不验证数据是否正确。</li>
</ul>
<h2 id="主要存储类型"><a href="#主要存储类型" class="headerlink" title="主要存储类型"></a>主要存储类型</h2><p>存储分为本地存储和进行漫游，漫游的话可以在多设备之间同步。 存储分为直接存储、Composite设置集合和Container容器。 其中这些存储类型可以相互嵌套。Container容器类似于一个文件夹可以作为许多设置的抽象集合，而Composite集合类似于一个文件夹，可以将同类的设置放一起，而直接存储可以存储单条信息。 Container中能够包含多个Composite和单条键值对，而Composite中可以包含多条键值对。之后将根据这些不同的存储方法对ApplicationData进行封装。</p>
<h2 id="代码实现"><a href="#代码实现" class="headerlink" title="代码实现"></a>代码实现</h2><p>代码通过模拟jQuery的连缀操作，可以在单行完成存储复杂类型数据的操作。</p>
<p>using System;<br>using System.Collections.Generic;<br>using Windows.Storage;</p>
<p>class SettingLib {</p>
<pre><code>//声明存储容器
private ApplicationDataContainer dataSettings;

//声明一些临时变量
private string tempSettingName;
private object tempSettingValue;
private string tempContainerName;
private string tempCompositeName;
private ApplicationDataContainer tempContainer;
private ApplicationDataCompositeValue tempComposite;
private ApplicationDataCompositeValue tempReadComposite;

//是否自动清除缓存的变量
private bool isAutoClearTemp;

//构造函数，默认为漫游设置和自动清除历史设置的缓存
public SettingLib(bool isRoaming = true, bool isAutoClearTemp = true) {
    if (isRoaming) {
        dataSettings = ApplicationData.Current.RoamingSettings;
    } else {
        dataSettings = ApplicationData.Current.LocalSettings;
    }
    this.isAutoClearTemp = isAutoClearTemp;
    tempContainer = null;
    tempComposite = null;
    tempReadComposite = null;
}

//创建直接存储,需要传入一个键值对
public SettingLib CreateSetting(string key, object value) {
    tempSettingName = key;
    tempSettingValue = value;
    return this;
}
//创建存储集合，需要传入集合的名称和键值对的List
public SettingLib CreateComposite(string compositeName, List&lt;Tuple&lt;string, object&gt;&gt; vals) {
    ApplicationDataCompositeValue composite = new ApplicationDataCompositeValue();
    foreach (Tuple&lt;string, object&gt; v in vals) {
        composite\[v.Item1\] = v.Item2;
    }
    tempComposite = composite;
    tempCompositeName = compositeName;
    return this;
}
//创建存储容器，需要传入容器的名称
//不考虑嵌套Container
public SettingLib CreateContainer(string containerName) {
    ApplicationDataContainer container = dataSettings.CreateContainer(containerName, ApplicationDataCreateDisposition.Always);
    tempContainer = container;
    tempContainerName = containerName;
    return this;
}

//将之前创建的各种存储类型进行组合之后进行存储
//可以在Container中包含Composite或者键值对，可以在Composite中包含多条键值对，可以直接存储键值对
//不考虑嵌套Container
public SettingLib SaveSetting() {
    if (tempContainer != null) {
        if (dataSettings.Containers.ContainsKey(tempContainerName)) {
            if (tempComposite != null) {
                dataSettings.Containers\[tempContainerName\].Values\[tempCompositeName\] = tempComposite;
            } else {
                dataSettings.Containers\[tempContainerName\].Values\[tempSettingName\] = tempSettingValue;
            }
        } else {
            throw new ArgumentException();
        }
    } else {
        if (tempComposite != null) {
            dataSettings.Values\[tempCompositeName\] = tempComposite;
        } else {
            dataSettings.Values\[tempSettingName\] = tempSettingValue;
        }
    }
    if (isAutoClearTemp) {
        ClearTemp();
    }
    return this;
}

//一次操作后清除缓存的方法
public SettingLib ClearTemp() {
    tempSettingValue = null;
    tempContainer = null;
    tempComposite = null;
    tempReadComposite = null;
    return this;
}
//如果没有设置自动清除缓存的话可以手动清除缓存,需要传入清除缓存的类型
public SettingLib ClearTemp(string content) {
    switch (content) {
        case &quot;Setting&quot;:
            tempSettingValue = null;
            break;
        case &quot;Container&quot;:
            tempContainer = null;
            break;
        case &quot;Composite&quot;:
            tempComposite = null;
            break;
        case &quot;ReadComposite&quot;:
            tempReadComposite = null;
            break;
        default:
            throw new ArgumentException();
    }
    return this;
}

//读取键值对存储
public object ReadSetting(string key) {
    object value = dataSettings.Values\[key\];
    return value;
}

//读取Composite中的所有键值对，并且以List返回
//不考虑嵌套Container
public List&lt;Tuple&lt;string, object&gt;&gt; ReadSetting(string compositeName, List&lt;string&gt; settingNames) {
    ApplicationDataCompositeValue composite;
    if (tempReadComposite != null) {
        composite = tempReadComposite;
    } else {
        composite = (ApplicationDataCompositeValue)ReadSetting(compositeName);
    }
    if (composite == null) {
        return null;
    } else {
        List&lt;Tuple&lt;string, object&gt;&gt; cs = new List&lt;Tuple&lt;string, object&gt;&gt;();
        foreach (string sn in settingNames) {
            cs.Add(new Tuple&lt;string, object&gt;(sn, composite\[sn\]));
        }
        return cs;
    }
}
//读取Container中指定名称的设置
//不考虑嵌套Container
public object ReadSetting(string containerName, string settingName) {
    bool hasContiner = dataSettings.Containers.ContainsKey(containerName);
    bool hasSetting = false;
    object settingValue = null;
    if (hasContiner) {
        hasSetting = dataSettings.Containers\[containerName\].Values.ContainsKey(settingName);
    }
    if (hasSetting) {
        settingValue = dataSettings.Containers\[containerName\].Values\[settingName\];
    }
    return settingValue;
}
//读取Container中设置集合中的所有键值对
public List&lt;Tuple&lt;string, object&gt;&gt; ReadSetting(string containerName, string compositeName, List&lt;string&gt; settingNames) {
    tempReadComposite = (ApplicationDataCompositeValue)ReadSetting(containerName, compositeName);
    List&lt;Tuple&lt;string, object&gt;&gt; ret = ReadSetting(null, settingNames);
    if (isAutoClearTemp) {
        ClearTemp();
    }
    return ret;
}

//删除某种设置
//不考虑嵌套Container
public void RemoveSetting(string settingName, bool isContainer = false) {
    if (isContainer) {
        dataSettings.DeleteContainer(settingName);
    } else {
        dataSettings.Values.Remove(settingName);
    }
}
</code></pre><p>}</p>
<h2 id="使用方法"><a href="#使用方法" class="headerlink" title="使用方法"></a>使用方法</h2><p>可以使用连缀操作在单行进行复杂的设置</p>
<p>public void makeSettings() {<br>    SettingLib settingLib = new SettingLib();<br>    settingLib.CreateContainer(“CampusNetwork”).CreateSetting(“campusNetworkAccountId”, id).SaveSetting();<br>    string id = (string)settingLib.ReadSetting(“CampusNetwork”, “campusNetworkAccountId”);<br>}</p>
<p>需要注意的点：</p>
<ul>
<li>在存储的时候使用连续的Create创建结构化的存储，最后使用SaveStting方法进行最终存储。</li>
<li>使用ReadSetting读取数据，具体使用可以参考ReadingSetting方法的每一种重载中的注释</li>
<li>在创建结构化存储的时候，可以在Container中包含Composite或者键值对，可以在Composite中包含多条键值对，可以直接存储键值对</li>
</ul>
<h2 id="获取文中代码"><a href="#获取文中代码" class="headerlink" title="获取文中代码"></a>获取文中代码</h2><p>在GitHub的HelloBUPT项目中可以得到代码：<a href="https://github.com/imaginezz/helloBUPT/blob/master/beiyou/CommonLibrary/SettingLib.cs" target="_blank" rel="noopener">https://github.com/imaginezz/helloBUPT/blob/master/beiyou/CommonLibrary/SettingLib.cs</a></p>
<h2 id="参考链接"><a href="#参考链接" class="headerlink" title="参考链接"></a>参考链接</h2><p>Windows 10 UWP开发：如何读取和保存设置：<a href="http://edi.wang/post/2015/11/20/uwp-read-write-settings?utm_source=tuicool&amp;utm_medium=referral" target="_blank" rel="noopener">http://edi.wang/post/2015/11/20/uwp-read-write-settings?utm_source=tuicool&amp;utm_medium=referral</a></p>
<p>windows 8 开发 Application Data：<a href="http://www.cnblogs.com/icuit/archive/2012/06/06/2538246.html" target="_blank" rel="noopener">http://www.cnblogs.com/icuit/archive/2012/06/06/2538246.html</a> MSDN ApplicationDataContainer Class：<a href="https://msdn.microsoft.com/zh-cn/library/windows/apps/windows.storage.applicationdatacontainer.aspx" target="_blank" rel="noopener">https://msdn.microsoft.com/zh-cn/library/windows/apps/windows.storage.applicationdatacontainer.aspx</a></p>

      
    </div>

    

    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/C/" rel="tag"># C#</a>
          
            <a href="/tags/UWP/" rel="tag"># UWP</a>
          
            <a href="/tags/存储/" rel="tag"># 存储</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2016/09/25/e4-bd-bf-e7-94-a8c-e5-b0-81-e8-a3-85-e4-b8-80-e4-b8-aauwp-e7-9a-84toast-e9-80-9a-e7-9f-a5-e7-b1-bb/" rel="next" title="使用C#封装一个UWP的Toast通知类">
                <i class="fa fa-chevron-left"></i> 使用C#封装一个UWP的Toast通知类
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2016/10/04/e7-a7-8b-e5-a4-a9-e8-92-99-e5-a4-aa-e5-a5-87/" rel="prev" title="秋天蒙太奇">
                秋天蒙太奇 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>


  </div>


          </div>
          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            Table of Contents
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            Overview
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="/images/avatar.jpg"
                alt="Jason Bian" />
            
              <p class="site-author-name" itemprop="name">Jason Bian</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">86</span>
                    <span class="site-state-item-name">posts</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">41</span>
                    <span class="site-state-item-name">categories</span>
                  
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">109</span>
                    <span class="site-state-item-name">tags</span>
                  
                </div>
              
            </nav>
          

          

          

          
          

          
          

          
            
          
          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#简介"><span class="nav-number">1.</span> <span class="nav-text">简介</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#主要存储类型"><span class="nav-number">2.</span> <span class="nav-text">主要存储类型</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#代码实现"><span class="nav-number">3.</span> <span class="nav-text">代码实现</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#使用方法"><span class="nav-number">4.</span> <span class="nav-text">使用方法</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#获取文中代码"><span class="nav-number">5.</span> <span class="nav-text">获取文中代码</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#参考链接"><span class="nav-number">6.</span> <span class="nav-text">参考链接</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2018</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Jason Bian</span>

  

  
</div>




  <div class="powered-by">Powered by <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a></div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">Theme – <a class="theme-link" target="_blank" href="https://theme-next.org">NexT.Gemini</a></div>




        








        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    
	
    

    
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>


























  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=6.4.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=6.4.0"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=6.4.0"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=6.4.0"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=6.4.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=6.4.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=6.4.0"></script>



  



  










  





  

  

  

  

  
  

  

  

  

  

  

</body>
</html>
